home *** CD-ROM | disk | FTP | other *** search
- ;
- ;DOS, VOLUME Labels
-
- =======================================================================
- Copyright (C) Copr. 1990, 1991 1992, 1993 by Sidney J. Kelly
- All Rights Reserved.
- Sidney J. Kelly
- 150 Woodhaven Drive
- Pittsburgh, PA 15228
- home phone 412-561-0950 (7pm to 9:30pm EST)
-
- CompuServe 70043,1656
- =======================================================================
-
- These routines provides routines to read and set the volume label
- on all DOS formatted disks. No ON ERROR necessary. This routine has
- been reworked to overwrite Norton's Safe Format volume labels, which DOS
- version 5.00 can't handle, but DOS version 3.x can.
-
- This library will work in PDS 7.x but will not work in the QBX
- environment because it uses NEAR strings. You must modify the string output
- routines to use LIBRARY calls to make it work inside QBX.EXE.
- Jim Mack has released some routines for PDS on COMPUSERVE MSSYS
- TRIMS.ASM. It shows how to pass far strings inside PDS.
-
- =================================================================
-
- QBASIC-MASM Interface Theory:
- Generally QBASIC only keeps simple variables, (INT,
- LONGINT, SINGLE and DOUBLE, and STRINGS) in DGROUP. Arrays and
- TYPE records are usually kept outside DGROUP, with only the
- STRING Descriptor or the undocumented Array descriptor kept in
- DGROUP. Thus, the library routines assume that all information
- passed from simple variables is information about a near (DGROUP)
- address. If we pass simple integers to MASM routines, and don't
- care to have MASM change those variables, we use BYVAL to send
- the information to MASM. BYVAL speeds up variable access by a
- factor of two. If we want to have MASM send information back
- about multiple variables, we must pass the address information
- for the variables without using BYVAL. If we use arrays, we must
- use a combination of BYVAL & VARSEG and BYVAL & VARPTR to get the
- information we need to manipulate the information inside the
- arrays. VARSEG and VARPTR are necessary because there is a very
- great chance that the arrays will be stored as far data (i.e. notstored in DGROUP). If you must get an array in DGROUP, put the
- array in COMMON.
- Text strings are sent by QBASIC as near address
- (relative to DS and DGROUP). The fist value in the descriptor is
- the length of the string. The second value is the offset address
- inside DGROUP. Fixed length strings and TYPE record strings are
- not referenced with string descriptors. For that reason, I don't
- allow such strings as variables in my routines.
- PDS/QBX Version 7.x stores strings in FAR DATA, outside
- DGROUP. Special routines are offered in the programmer's package
- to find address and length of far strings.
- You must use the following library routines included inside the QBX environment.
-
- Use the following library calls:
- EXTRN StringAddress:FAR
- EXTRN StringLength:FAR
-
- How to use StringLength (must clear direction flag CLD):
- Basic program must pass address of string descriptor on stack
- Push StringDescriptor ; push it back on stack
- call StringLength ; call routine
- length returned in AX
-
- How to use StringAddress (must clear direction flag CLD):
- Basic program must pass address of string descriptor on stack
-
- Push StringDescriptor ; push it back on stack
- call StringAddress ; call routine
- address returned in DX:AX ; DX has segment address, AX has
- ; offset
-
- QBASIC requires that MASM preserve BP, SI, DI, DS, and
- keep the direction flag clear (CLD). All these routines do this.
- You will note that MICROSOFT'S CALL INTERRUPT routines do not
- save BP (apparently to give you access to some EGA VGA palette
- and character font selection routines in the BIOS), and thus will
- crash if a critical error occurs. MICROSOFT offers a replacement
- routine that overcomes this error by preventing any change to BP.
- You should get it if you don't already have it. QBX requires that ES
- be preserved for FAR strings. THIS HAS NOT BEEN DONE!
- The choice of defining MASM routines as SUB's or
- FUNCTION's depends on whether you want to get information from
- MASM in DX:AX (the format for FUNCTIONs), or if the MASM routine
- either sends back no information or more than one variable (the
- format for SUBs). For simple one variable routines when MASM is
- just returning a value, use FUNCTIONs. To use such functions
- inside QBASIC you must either assign the value of the function to
- a QBASIC variable or use 1) IF ... THEN statements (C style), or
- 2) PRINT statements. For everything else use SUBS.
- Note due to an error in the QBASIC text parser, always
- use the CALL keyword to call the library routines if there is any
- chance that you will use a colon as a separator on a line AND the
- library routine does not take any parameters. Without the CALL
- keyword, the QBASIC parser assumes that the routine name followed
- by a colon is intended as a line label, and not as a SUB name.
- You must use CALL if you will use a SUB that does not need any
- parameters and will follow that SUB name by a colon.
- MASM Theory:
- The MASM routines were designed to be compiled with MS
- QUICK ASSEMBLER, using simplified segment names. They should
- compile with MS MASM 5.1 and above. The DOSSEG keyword might not
- be supported by your version of MASM, so use the MASM keyword
- that arranges the segments in DOS order, rather than ALPHA order.
- If you use TASM with QUIRKS and MASM51 you should be able to
- compile these programs with TASM. The @@, @f, @b are local
- labels used so I can skip ahead without having to think up
- unique names. Don't use @@, @f,@b inside MASM Macros,
- use LOCAL alphanumeric names instead. MASM too easily can
- lose track of which local label you mean.
- The simplified directives really save time when you
- have to identify variables on the stack, and push and pop
- variables. I use the full PROC function and the regular PROCkeywords interchangeably. Full PROC format is not necessary when
- there is no need to address variables on the stack (i.e. no need
- to change BP to address the stack) and the QBASIC routine is
- described as a FUNCTION or a SUB that does not take or return
- parameters..
- The EVEN directive is used to word align loops for
- 80286 and 80386 machines. EVEN inserts NOPS as necessary to word
- align loops. The QBASIC BYVAL directive is used to get
- information directly from QBASIC without having to use [BX] or
- [SI] to fish out the correct information. To allow for
- compatibility with the 8088 chip, shifts rather than MULs are
- used for speed. I use .code to store most of my variables to
- save space in DGROUP, which is comparatively tiny and easily
- filed with string data.
- To program in OS/2 code segment variables are
- "verbotten", and you must use local variables on the stack. I
- don't have access to the OS/2 DOS compatibility box, so I don't
- know how these routines would work under OS/2. I am certain that
- none of these routines would work smoothly under protected mode
- because they often access the BIOS or the hardware.
-
- What's available:
-
- DOSBASIC ZIP - (released 12-19-90). The first draft
- of many of these routines. The current version is much faster and does
- more. Uploaded on GENIE and COMPUSERVE
-
- VIDBASIC (released 11-29-90)
- - A selection of text mode video routines. Bannerware.
- The library allows the user to select, move, switch, change, save,
- restore, draw boxes, and write with lightening speed. MASM .ASM code,
- .OBJ, and a demo routine with source is included. Uploaded by author on
- GENIE and COMPUSERVE.
-
- KEYBASIC - (released 12-14-90)
- A selection of Microsoft Compatible Mouse and
- Keyboard utilities. Text mode mouse utilities. Fast mouse utilities.
- Turn off CONTROL-BREAK so you can use LINE INPUT$ without error if user
- pushes the Control-Break key. Bannerware. MASM .ASM code, .OBJ, and a
- demo routine with source is included. Uploaded by author on GENIE and
- COMPUSERVE.
-
- PDS-VID ZIP (released 03-01-91)
- Shows how to use far strings inside QBX/PDS. Gives all the
- proper library call format. Uploaded on COMPUSERVE.
-
- EDIT-QB ZIP (released 05-23-91)
- A fast on screen text line editor. Should be compatible with
- all displays because it uses bios calls to display characters.
-
- VERT-LIB ZIP (released 12-31-91)
- with update VERT-L1 ZIP (04-27-92). This shows a complex
- shell for QBASIC near strings. Complete display control, PULL DOWN
- and POP UP menus, and simple help box. Works with MOUSE or keyboard.
- Full source MASM and QBASIC included.
-
- QB-EQUIP ZIP (released 12-31-92)
- A fast set of hardware ID routines with MASM source. Bannerware.
- Uploaded on COMPUSERVE.
-
- As always, constructive criticism is desired. These libraries
- were released as Bannerware (you can use the .OBJ files) but you can't
- sell the source) to encourage a sharing of ideas. If you have
- something to say, I welcome your comments. With application programs
- there appears to be a significant and speedy exchange of ideas,
- programmers, on the other hand, seem to move at a much slower pace, with
- Jim Mack being the notable exception.